package com.bynk.bynk_demo.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bynk.bynk_demo.model.Book;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface BookMapper extends BaseMapper<Book>{

    @Select("select book_name from book")
    public List<String> findAllBookName();

    @Insert("insert into book (book_id,  book_name,ISBN)values (#{bookId},#{bookName},#{isbn})")
    public int addBook(Book book);

    @Delete("delete from book where book_name = #{bookName}")
    public int delBookByName(String bookName);

    @Update("update book set book_name = #{newName} where book_name = #{oldName}")
    public int modBookNameByName(String oldName,String newName);

    @Select("select book_name from book where book_type=#{typeId}")
    public List<String> getBookNamesByTypeId(Integer typeId);

}

